const express = require("express");
const app = express();
const info = [
    {
        id:1,
        title:"新闻标题1",
        content:"中国女足，中国女篮，中国女排"
    },
    {
        id:2,
        title:"新闻标题2",
        content:"中国男足，中国男篮，中国男排"
    }
]
app.get("/info",(req,res)=>{
    res.json(info)
})
app.get("/info/:id",(req,res)=>{
    const {id} = req.params;
    res.json(info.find(v=>v.id===id/1))
})
app.listen(80,()=>{
    console.log("success");
})